package com.immediatus.engine.primitive;

import com.immediatus.engine.shape.RectangularShape;
import com.immediatus.graphics.vertex.RectangleVertexBuffer;

import javax.microedition.khronos.opengles.GL11;

public abstract class BaseRectangle extends RectangularShape{

    public BaseRectangle(final float x_, final float y_, final float w_, final float h_){
        super(x_, y_, w_, h_, new RectangleVertexBuffer(GL11.GL_STATIC_DRAW, true));
        this.updateVertexBuffer();
    }

    public BaseRectangle(final float x_, final float y_, final float w_, final float h_, final RectangleVertexBuffer vertexBuffer_){
        super(x_, y_, w_, h_, vertexBuffer_);
    }

    @Override
    public RectangleVertexBuffer getVertexBuffer(){
        return (RectangleVertexBuffer) this._VertexBuffer;
    }

    @Override
    protected void onUpdateVertexBuffer(){
        this.getVertexBuffer().update(this.getWidth(), this.getHeight());
    }
}
